<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="styles/css/global.css">
		<SCRIPT type="text/javascript" src="commons/dojo.js"></SCRIPT>
	    <script type="text/javascript">
			dojo.require("dojo.widget.validate");
			
		</script>
<script>
		function jumpToPageFunc(pageNo,sort)
			{
				//guestForm.action="guest.do?method=getGuest&pageNo="+pageNo+"&sort="+sort;
				//guestForm.submit();
				var url ="guest.do?method=getContact&pageNo="+pageNo+"&sort="+sort;
				goUrl(url);
			}
		</script>
<%
	String value = (String)request.getAttribute("value");
	Integer nameType = (Integer)request.getAttribute("nameType");
	Integer month = (Integer)request.getAttribute("month");
%>
<script  >
          function   goUrl(url)   {  
          	//	alert("here");
          		document.forms[1].action = url ;
               // document.paramForm.action   =   url;
            //    document.forms[1].target   =   "_self ";
                document.forms[1].submit();
        }
</script> 
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="localTdBg">
					当前位置：	
					
						联系人管理 -- 查看联系人
					
				</td>
			</tr>
			
</table>
		<html:form  method="post" action="guest.do?method=getContact">
		<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" id="searchFormTable">
			<tr>
				<td width="100%" valign="middle">
					查找联系人：
					<input name="value" type="text" id="searchFormInput" >
					<select name="nameType" class="formSelectList" >
						<OPTION value="1">联系人名称</OPTION>
						<OPTION value="2">学校</OPTION>
						<OPTION value="3">课程</OPTION>
						<OPTION value="4">操作人</OPTION>
						<OPTION value="5">电话</OPTION>
					</select>
					<select name="month" class="formSelectList">
					<OPTION value="13">全部</OPTION>
					<%
						for(int i=0;i<12;i++){
					%>
						<OPTION value="<%=i %>"><%=i +1%>月</OPTION>
					<%		
						}
					%>
					</select>
				    <input name="Submit" type="submit" id="searchFormSubmit" value="查询">
				</td>
			</tr>
	  </table>
	  </html:form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td class="listTitle"><a href="guest.do?method=listContact&sort=name">客户名称</a></td>
		<td class="listTitle"><a href="guest.do?method=listContact&sort=tel">电话</a></td>
		<td class="listTitle"><a href="guest.do?method=listContact&sort=schoolId">学校</a></td>
		<td class="listTitle"><a href="guest.do?method=listContact&sort=lessonTypeId">课程分类</a></td>
		<td class="listTitle"><a href="guest.do?method=listContact&sort=lesson">课程</a></td>
		<td class="listTitle">添加时间</td>
		<td class="listTitle">创建人</td>
		<td class="listTitle">编辑</td>
	</tr>
		<c:forEach var="contact" items="${contactList}">
			<tr>
				<td class="listContext">${contact.name }&nbsp</td>
				<td class="listContext">${contact.tel }&nbsp</td>
		 		<td class="listContext"><my:schoolName sid="${contact.schoolId }" /></td>
		 		<td class="listContext"><my:lessonTypeValue ltid="${contact.lessonTypeId}" /></td>
		 		<td class="listContext">${contact.lesson }&nbsp</td>
			    <td class="listContext"><my:date value="${contact.logonDate }" pattern="yyyy-MM-dd" /></td>
				<td class="listContext"><my:userName uid="${contact.userId }" /></td>
				<td class="listContext">
				<a href="guest.do?method=showContact&cid=${contact.cid }">查看</a>&nbsp&nbsp</a>
				</td>
			</tr>
		</c:forEach>
</table>
<html:form  method="post" action="guest.do?method=getContact">
<input name="value" type="hidden"  value ="<%=value%>">
<input name="nameType" type="hidden"  value ="<%=nameType%>">
<input name="month" type="hidden"  value ="<%=month%>">
</html:form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td colspan="2">
					<div align="center">
						共有：
						<span class="fontLight">
							${pageInfo.totalResult}
						</span>
						条记录&nbsp;${pageInfo.currentPage }/${pageInfo.totalPage }页 &nbsp; 当前第
						<span class="fontLight">
							${pageInfo.currentPage}
						</span>
						页&nbsp;&nbsp;
						<c:if test="${pageInfo.totalResult>0}">
						 <a href="javaScript:goUrl('guest.do?method=getContact&sort=${sort }&pageNo=1')">
						  首页
						</a>
						</c:if>
						&nbsp;
						<c:if test="${pageInfo.currentPage>1}">
						<a href="javaScript:goUrl('guest.do?method=getContact&sort=${sort }&pageNo=${pageInfo.currentPage-1}')">
							上一页
						</a>
						</c:if>
						<c:if test="${pageInfo.currentPage<pageInfo.totalPage}">
						  <a href="javaScript:goUrl('guest.do?method=getContact&sort=${sort }&pageNo=${pageInfo.currentPage+1}')">
						&nbsp;下一页&nbsp;
						</a>
						</c:if>
						<c:if test="${pageInfo.currentPage<pageInfo.totalPage}">
						   <a href="javaScript:goUrl('guest.do?method=getContact&sort=${sort }&pageNo=${pageInfo.totalPage}')">
						   尾页&nbsp;
						   </a>
						</c:if>
						<c:if test="${pageInfo.totalResult>1}">
						&nbsp;跳转到
						<select name="jumpToPage" onchange="javascript:jumpToPageFunc(this.value,'${sort}')">
							<c:forEach var="pageCount" begin="1" end="${pageInfo.totalPage}">
									<c:choose>
										<c:when test="${pageCount==pageInfo.currentPage}"><option selected value=${pageCount}>${pageCount}</option></c:when>
										<c:otherwise><option value=${pageCount}>${pageCount}</option></c:otherwise>
									</c:choose>
							</c:forEach>
						</select>
						页
						</c:if>
					</div>
				</td>
			</tr>
		</table>

</body>
</html>